package mysql

import "gorm.io/gorm"

type Good struct {
	gorm.Model
	Price int    `gorm:"type:int(11);not null;"`
	Stock int    `gorm:"type:int(11);not null;"`
	Title string `gorm:"type:varchar(256);not null;"`
	Name  int    `gorm:"type:int(11);not null;"`
}

type Cart struct {
	gorm.Model
	UserId  int    `gorm:"type:int(11);not null;"`
	GoodsId int    `gorm:"type:int(11);not null;"`
	Stock   int    `gorm:"type:int(11);not null;"`
	Title   string `gorm:"type:varchar(256);not null;"`
}

func (g *Good) Find(Id int) error {

	return DB.Debug().Where("id = ?", Id).Model(&g).Limit(1).First(&g).Error

}
